﻿namespace WMS6.Services
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.ServiceModel;
    using System.ServiceModel.Activation;
    using WMS6.BLL;
    using WMS6.Common;
    using WMS6.DataEntity;
    using WMS6.QueryEntity;

    [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed), ServiceBehavior(InstanceContextMode=InstanceContextMode.PerCall)]
    public class TransportMgtService : ITransportMgtService
    {
        public string ConFirmPOD(PodInfo podInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new PodBLL(pubParasInfo).ConFirm(podInfo);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_ConFirmPOD", podInfo, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return temp;
        }

        public string DeleteBolDetailInfo(List<string> BolDetailIDs, List<string> lineIDs, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new BolDetailBLL(pubParasInfo).Delete(BolDetailIDs, lineIDs);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_DeleteBolDetailInfo", BolDetailIDs, lineIDs, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return temp;
        }

        public string DeleteBolInfo(List<string> bolIDs, PubParasInfo pubParasInfo)
        {
            string result = string.Empty;
            try
            {
                result = new BolBLL(pubParasInfo).DeleteBol(bolIDs);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return result;
        }

        public string DeleteDeliveryOrder(List<string> deliveryOrderIDs, PubParasInfo pubParasInfo)
        {
            string strTemp = string.Empty;
            try
            {
                strTemp = new DeliveryOrderBLL(pubParasInfo).Delete(deliveryOrderIDs);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_DeleteDeliveryOrder", deliveryOrderIDs, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return strTemp;
        }

        public string DeleteDispatchInfo(List<string> dispatchInfoDs, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new DispatchBLL(pubParasInfo).Delete(dispatchInfoDs);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_DeleteDispatchInfo", dispatchInfoDs, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return temp;
        }

        public string DeletePodInfo(List<string> podIDs, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new PodBLL(pubParasInfo).Delete(podIDs);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_DeletePodInfo", podIDs, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return temp;
        }

        public string DeleteTrackingDetail(List<string> trackingDetailIDs, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new TrackingDetailBLL(pubParasInfo).Delete(trackingDetailIDs);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_DeleteTrackingDetail", trackingDetailIDs, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return temp;
        }

        public DataSet GetAllBolDetailInfo(PubParasInfo pubParasInfo)
        {
            try
            {
                BolDetailBLL bolDetailBll = new BolDetailBLL(pubParasInfo);
                return bolDetailBll.GetAllInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public DataSet GetAllBolInfo(PubParasInfo pubParasInfo)
        {
            try
            {
                BolBLL bolBll = new BolBLL(pubParasInfo);
                return bolBll.GetAllInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public DataSet GetAllDeliveryOrderInfo(PubParasInfo pubParasInfo)
        {
            try
            {
                DeliveryOrderBLL deliveryOrderBll = new DeliveryOrderBLL(pubParasInfo);
                return deliveryOrderBll.GetAllInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public DataSet GetAllDispatchInfo(PubParasInfo pubParasInfo)
        {
            try
            {
                DispatchBLL dispatchBll = new DispatchBLL(pubParasInfo);
                return dispatchBll.GetAllInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public DataSet GetAllPodInfo(PubParasInfo pubParasInfo)
        {
            try
            {
                PodBLL podBll = new PodBLL(pubParasInfo);
                return podBll.GetAllInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public DataSet GetAllTrackingDetailInfo(PubParasInfo pubParasInfo)
        {
            try
            {
                TrackingDetailBLL trackingDetailBll = new TrackingDetailBLL(pubParasInfo);
                return trackingDetailBll.GetAllInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public List<BolDetailInfo> GetBolDetailInfoByDeliveryOrderIDsAndEquipmentTypeID(List<string> DeliveryOrderIDs, string EquipmentTypeIDs, string types, PubParasInfo pubParasInfo)
        {
            List<BolDetailInfo> bolDetailInfos = new List<BolDetailInfo>();
            try
            {
                BolDetailBLL bolDetailBll = new BolDetailBLL(pubParasInfo);
                return bolDetailBll.GetBolDetailInfoByDeliveryOrderIDsAndEquipmentTypeID(DeliveryOrderIDs, EquipmentTypeIDs, types);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return bolDetailInfos;
        }

        public BolDetailInfo GetBolDetailInfoByID(string bolDetailID, string lineID, PubParasInfo pubParasInfo)
        {
            try
            {
                BolDetailBLL bolDetailBll = new BolDetailBLL(pubParasInfo);
                return bolDetailBll.GetInfoByID(bolDetailID, lineID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public DataSet GetBolDetailInfoByQueryEntity(BolDetailQueryEntity bolDetailQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                BolDetailBLL bolDetailBll = new BolDetailBLL(pubParasInfo);
                return bolDetailBll.GetInfoByQueryEntity(bolDetailQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public List<BolDetailInfo> GetBolDetailInfoListByID(string bolDetailID, PubParasInfo pubParasInfo)
        {
            List<BolDetailInfo> bolDetailInfos = new List<BolDetailInfo>();
            try
            {
                BolDetailBLL bolDetailBll = new BolDetailBLL(pubParasInfo);
                return bolDetailBll.GetBolDetailInfoListByID(bolDetailID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return bolDetailInfos;
        }

        public BolInfo GetBolInfoByID(string bolID, PubParasInfo pubParasInfo)
        {
            try
            {
                BolBLL bolBll = new BolBLL(pubParasInfo);
                return bolBll.GetInfoByID(bolID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public DataSet GetBolInfoByQueryEntity(BolQueryEntity bolQueryEntity, PubParasInfo pubParasInfo)
        {
            try
            {
                BolBLL bolBll = new BolBLL(pubParasInfo);
                return bolBll.GetInfoByQueryEntity(bolQueryEntity);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public DeliveryOrderInfo GetDeliveryOrderInfoByID(string deliveryOrderID, PubParasInfo pubParasInfo)
        {
            DeliveryOrderInfo deliveryOrderInfo = null;
            try
            {
                deliveryOrderInfo = new DeliveryOrderBLL(pubParasInfo).GetInfoByID(deliveryOrderID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return deliveryOrderInfo;
        }

        public DeliveryOrderInfo GetDeliveryOrderInfoByOrderIDDocType(string orderID, string docType, PubParasInfo pubParasInfo)
        {
            try
            {
                DeliveryOrderBLL deliveryOrderBll = new DeliveryOrderBLL(pubParasInfo);
                return deliveryOrderBll.GetDeliveryOrderInfoByOrderIDDocType(orderID, docType);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public DataSet GetDeliveryOrderInfoByQueryEntity(DeliveryOrderQueryEntity deliveryOrderQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                DeliveryOrderBLL deliveryOrderBll = new DeliveryOrderBLL(pubParasInfo);
                return deliveryOrderBll.GetInfoByQueryEntity(deliveryOrderQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public DispatchInfo GetDispatchInfoByID(string dispatchID, PubParasInfo pubParasInfo)
        {
            try
            {
                DispatchBLL dispatchBll = new DispatchBLL(pubParasInfo);
                return dispatchBll.GetInfoByID(dispatchID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public DataSet GetDispatchInfoByQueryEntity(DispatchQueryEntity dispatchQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                DispatchBLL dispatchBll = new DispatchBLL(pubParasInfo);
                return dispatchBll.GetInfoByQueryEntity(dispatchQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public PodInfo GetPodInfoByID(string podID, PubParasInfo pubParasInfo)
        {
            try
            {
                PodBLL podBll = new PodBLL(pubParasInfo);
                return podBll.GetInfoByID(podID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public DataSet GetPodInfoByQueryEntity(PodQueryEntity podQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                PodBLL podBll = new PodBLL(pubParasInfo);
                return podBll.GetInfoByQueryEntity(podQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public TrackingDetailInfo GetTrackingDetailInfoByID(string trackingDetailID, PubParasInfo pubParasInfo)
        {
            try
            {
                TrackingDetailBLL trackingDetailBll = new TrackingDetailBLL(pubParasInfo);
                return trackingDetailBll.GetInfoByID(trackingDetailID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public DataSet GetTrackingDetailInfoByQueryEntity(TrackingDetailQueryEntity trackingDetailQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                TrackingDetailBLL trackingDetailBll = new TrackingDetailBLL(pubParasInfo);
                return trackingDetailBll.GetInfoByQueryEntity(trackingDetailQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public DataSet GetTrackingInfoByQueryEntity(TrackingDetailQueryEntity trackingDetailQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                TrackingDetailBLL trackingDetailBll = new TrackingDetailBLL(pubParasInfo);
                return trackingDetailBll.GetTrackingByQueryList(trackingDetailQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return null;
        }

        public string ImportFormShippingOrder(string orderID, string vDeliveryOrderID, PubParasInfo pubParasInfo)
        {
            string retrunStr = string.Empty;
            try
            {
                retrunStr = new DeliveryOrderBLL(pubParasInfo).ImportFormShippingOrder(orderID, vDeliveryOrderID);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_ImportFormShippingOrder", orderID, vDeliveryOrderID, pubParasInfo);
                return retrunStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return retrunStr;
        }

        public string InsertBolDetailInfo(BolDetailInfo bolDetailInfo, PubParasInfo pubParasInfo)
        {
            string bolDetailInfoID = string.Empty;
            try
            {
                bolDetailInfoID = new BolDetailBLL(pubParasInfo).Insert(bolDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_InsertBolDetailInfo", bolDetailInfo, pubParasInfo);
                return bolDetailInfoID;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return bolDetailInfoID;
        }

        public string InsertBolDetailList(List<BolDetailInfo> bolDetailInfos, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new BolDetailBLL(pubParasInfo).InsertBolDetailList(bolDetailInfos);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_InsertBolDetailList", bolDetailInfos, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return temp;
        }

        public string InsertBolInfo(BolInfo bolInfo, PubParasInfo pubParasInfo)
        {
            string result = string.Empty;
            try
            {
                result = new BolBLL(pubParasInfo).InsertBol(bolInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return result;
        }

        public string InsertDeliveryOrder(DeliveryOrderInfo deliveryOrderInfo, PubParasInfo pubParasInfo)
        {
            string deliveryOrderInfoID = string.Empty;
            try
            {
                deliveryOrderInfoID = new DeliveryOrderBLL(pubParasInfo).Insert(deliveryOrderInfo);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_InsertDeliveryOrder", deliveryOrderInfo, pubParasInfo);
                return deliveryOrderInfoID;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return deliveryOrderInfoID;
        }

        public string InsertDispatchAndBolDetailList(DispatchInfo dispatchInfo, List<BolDetailInfo> bolDetailInfos, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new DispatchBLL(pubParasInfo).InsertDispatchAndBolDetailList(dispatchInfo, bolDetailInfos);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_InsertDispatchAndBolDetailList", dispatchInfo, bolDetailInfos, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return temp;
        }

        public string InsertDispatchInfo(DispatchInfo dispatchInfo, PubParasInfo pubParasInfo)
        {
            string dispatchInfoID = string.Empty;
            try
            {
                dispatchInfoID = new DispatchBLL(pubParasInfo).Insert(dispatchInfo);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_InsertDispatchInfo", dispatchInfo, pubParasInfo);
                return dispatchInfoID;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return dispatchInfoID;
        }

        public string InsertPodInfo(PodInfo podInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new PodBLL(pubParasInfo).Insert(podInfo);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_InsertPodInfo", podInfo, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return temp;
        }

        public string InsertTrackingDetail(TrackingDetailInfo trackingDetailInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new TrackingDetailBLL(pubParasInfo).Insert(trackingDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_InsertTrackingDetail", trackingDetailInfo, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return temp;
        }

        public string PODDeliveryOrderStatus(DeliveryOrderInfo deliveryOrderInfo, PubParasInfo pubParasInfo)
        {
            string result = string.Empty;
            try
            {
                DeliveryOrderBLL deliveryOrderBll = new DeliveryOrderBLL(pubParasInfo);
                return deliveryOrderBll.PODDeliveryOrderStatus(deliveryOrderInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return result;
        }

        public string UpdateBolDetailInfo(BolDetailInfo bolDetailInfo, PubParasInfo pubParasInfo)
        {
            string bolDetailInfoID = string.Empty;
            try
            {
                bolDetailInfoID = new BolDetailBLL(pubParasInfo).Update(bolDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_UpdateBolDetailInfo", bolDetailInfo, pubParasInfo);
                return bolDetailInfoID;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return bolDetailInfoID;
        }

        public string UpdateBolDetailList(List<BolDetailInfo> bolDetailInfos, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new BolDetailBLL(pubParasInfo).UpdateBolDetailList(bolDetailInfos);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_UpdateBolDetailList", bolDetailInfos, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return temp;
        }

        public string UpdateBolInfo(BolInfo bolInfo, PubParasInfo pubParasInfo)
        {
            string result = string.Empty;
            try
            {
                result = new BolBLL(pubParasInfo).UpdateBol(bolInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return result;
        }

        public string UpdateDeliveryOrder(DeliveryOrderInfo deliveryOrderInfo, PubParasInfo pubParasInfo)
        {
            string deliveryOrderInfoID = string.Empty;
            try
            {
                deliveryOrderInfoID = new DeliveryOrderBLL(pubParasInfo).Update(deliveryOrderInfo);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_UpdateDeliveryOrder", deliveryOrderInfo, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return deliveryOrderInfoID;
        }

        public string UpdateDispatchInfo(DispatchInfo dispatchInfo, PubParasInfo pubParasInfo)
        {
            string dispatchInfoID = string.Empty;
            try
            {
                dispatchInfoID = new DispatchBLL(pubParasInfo).Update(dispatchInfo);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_UpdateDispatchInfo", dispatchInfo, pubParasInfo);
                return dispatchInfoID;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return dispatchInfoID;
        }

        public string UpdatePodInfo(PodInfo podInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new PodBLL(pubParasInfo).Update(podInfo);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_UpdatePodInfo", podInfo, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return temp;
        }

        public string UpdateTrackingDetail(TrackingDetailInfo trackingDetailInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new TrackingDetailBLL(pubParasInfo).Update(trackingDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtService_UpdateTrackingDetail", trackingDetailInfo, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "ITransportMgtService异常");
            }
            return temp;
        }
    }
}

